<?php

defined('In33hao') or exit('Access Invalid!');
class indexControl{

    public function indexOp() {
//        $model = Model();
//        $type = $_POST['type'];
//        switch ($type) {
//            case 1:
//                $fields = 'member_name,member_mobile,member_points,available_predeposit,member_avatar';
//                $condition['member_id'] = $_POST['mid'];
//                $res = $model->table('member')->field($fields)->where($condition)->find();
//                break;
//            case 2:
//
//                break;
//            default :
//                $res = '小屁孩，滚回去玩泥巴！';
//        }
//        output_data(['info',$res]);
        echo json_encode(['a'=>'b']);exit;
    }

    public function output_data($datas, $extend_data = array(), $error = false) {
        $data = array();
        $data['code'] = 200;
        if($error) {
            $data['code'] = 400;
        }
        if(!empty($extend_data)) {
            $data = array_merge($data, $extend_data);
        }
        $data['datas'] = $datas;
        $jsonFlag = 0 && C('debug') && version_compare(PHP_VERSION, '5.4.0') >= 0
            ? JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE
            : 0;
        if ($jsonFlag) {
            header('Content-type: text/plain; charset=utf-8');
        }
        if (!empty($_GET['callback'])) {
            echo $_GET['callback'].'('.json_encode($data, $jsonFlag).')';die;
        } else {
            header("Access-Control-Allow-Origin:*");
            echo json_encode($data, $jsonFlag);die;
        }
    }


}
